package com.feilx.changggou.order.controller;

import java.util.Arrays;


import com.changgou.bean.PageVo;
import com.changgou.bean.QueryCondition;
import com.changgou.bean.Resp;
import com.changgou.pojo.order.TbReturnOrderEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.feilx.changggou.order.service.TbReturnOrderService;




/**
 *
 *
 * @author feilx
 * @email 852371260@qq.com
 * @date 2020-08-13 21:26:27
 */
@Api(tags = " 管理")
@RestController
@RequestMapping("order/tbreturnorder")
public class TbReturnOrderController {
    @Autowired
    private TbReturnOrderService tbReturnOrderService;

    /**
     * 列表
     */
    @ApiOperation("分页查询(排序)")
    @GetMapping("/list")
    public Resp<PageVo> list(QueryCondition queryCondition) {
        PageVo page = tbReturnOrderService.queryPage(queryCondition);

        return Resp.ok(page);
    }


    /**
     * 信息
     */
    @ApiOperation("详情查询")
    @GetMapping("/info/{id}")
    public Resp<TbReturnOrderEntity> info(@PathVariable("id") Long id){
		TbReturnOrderEntity tbReturnOrder = tbReturnOrderService.getById(id);

        return Resp.ok(tbReturnOrder);
    }

    /**
     * 保存
     */
    @ApiOperation("保存")
    @PostMapping("/save")
    public Resp<Object> save(@RequestBody TbReturnOrderEntity tbReturnOrder){
		tbReturnOrderService.save(tbReturnOrder);

        return Resp.ok(null);
    }

    /**
     * 修改
     */
    @ApiOperation("修改")
    @PostMapping("/update")
    public Resp<Object> update(@RequestBody TbReturnOrderEntity tbReturnOrder){
		tbReturnOrderService.updateById(tbReturnOrder);

        return Resp.ok(null);
    }

    /**
     * 删除
     */
    @ApiOperation("删除")
    @PostMapping("/delete")
    public Resp<Object> delete(@RequestBody Long[] ids){
		tbReturnOrderService.removeByIds(Arrays.asList(ids));

        return Resp.ok(null);
    }

}
